package com.yksj.healthtalk.ui.doctorstation.active;

import org.universalimageloader.core.DefaultConfigurationFactory;
import org.universalimageloader.core.ImageLoader;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.yksj.healthtalk.comm.BaseFragmentActivity;
import com.yksj.healthtalk.ui.R;
//奖品介绍
public class PrizeIntroduceActivity extends BaseFragmentActivity implements OnClickListener {
	
	JSONObject mJsonObject;
	
	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		setContentView(R.layout.prize_introduce_layout);
		
		String json = null;
		if(arg0 != null){
			json = arg0.getString("json");
		}else{
			json = getIntent().getStringExtra("json");
		}
		try{
			mJsonObject = JSON.parseObject(json);
		}catch(JSONException e){
		}
		
		initUI();
	}
	
	@Override
	protected void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		outState.putString("json", mJsonObject.toJSONString());
	}
	
	@Override
	public void onClick(View v) {
		switch(v.getId()){
		case R.id.title_back:
			finish();
			break;
		}
	}
	
	private void initUI(){
		initTitle();
		setTitle("奖品介绍");
		setBackBtn("返回",this);
		
		ImageLoader.getInstance().displayImage(
				mJsonObject.getString("BIG_PIC_ADDR"),
				(ImageView)findViewById(R.id.prize_img),DefaultConfigurationFactory.createPrizeDraw(this));
		
		TextView textView  = (TextView)findViewById(R.id.prize_introduce);
		textView.setText(mJsonObject.getString("PRIZE_NAME"));
		textView  = (TextView)findViewById(R.id.prize_des);
		textView.setText(mJsonObject.getString("PRIZE_DESC"));
	}
	
}
